package com.justgame.project.service.just.controller;

import com.justgame.project.base.annotation.ProtectAccess;
import com.justgame.project.cloud.common.constant.Result;
import com.justgame.project.service.api.dto.JustGameScoreDTO;
import com.justgame.project.service.just.service.JustGameScoreService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

@RestController
@RequestMapping("/just/score")
public class JustGameScoreController {
    @Resource
    private JustGameScoreService scoreService;

    /**
     * 打分
     *
     * @param dto
     * @return
     */
    @PutMapping("push")
    @ProtectAccess(value = 3L, message = "请勿频繁提交！")
    public Result<Object> pushScore(@Valid @RequestBody JustGameScoreDTO dto) {
        return Result.status(scoreService.pushScore(dto));
    }

    @GetMapping("get-score")
    @ProtectAccess(message = "请勿频繁提交！")
    public Result<Object> getScore(String id) {
        return Result.OK(scoreService.getScore(id));
    }


}
